package visual;

import java.awt.event.KeyEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Event;
import java.awt.BorderLayout;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.KeyStroke;
import java.awt.Point;

import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JMenuItem;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JFrame;
import javax.swing.JDialog;
import java.awt.Dimension;
import javax.swing.WindowConstants;

public class Principal {

	private JFrame jFrame = null;  //  @jve:decl-index=0:visual-constraint="10,10"
	private JPanel jContentPane = null;
	private JMenuBar jJMenuBar = null;
	private JMenu fileMenu = null;
	private JMenu editMenu = null;
	private JMenu helpMenu = null;
	private JMenuItem exitMenuItem = null;
	private JMenuItem aboutMenuItem = null;
	private JMenuItem cutMenuItem = null;
	private JMenuItem copyMenuItem = null;
	private JMenuItem pasteMenuItem = null;
	private JMenuItem saveMenuItem = null;
	private JDialog aboutDialog = null;
	private JPanel aboutContentPane = null;
	private JLabel aboutVersionLabel = null;
	private JMenu cadastroMenu = null;
	private JMenu movimentacaoMenu = null;
	private JMenu relatorioMenu = null;
	private JMenu utilitariosMenu = null;
	private JMenuItem cadastroEmpresaMenuItem = null;
	private JMenuItem cadastroFolhasMenuItem = null;
	private JMenu cadastroTabelaMenu = null;
	private JMenu cadastroTabelaFuncionarioMenu = null;
	private JMenu cadastroTabelaFaixaMenu = null;
	private JMenuItem cadastroTabelaFuncionarioCargoMenuItem = null;
	private JMenuItem cadastroTabelaFuncionarioCBOMenuItem = null;
	private JMenuItem cadastroTabelaFaixaSalarioFamiliaMenuItem = null;
	private JMenuItem cadastroTabelaFaixaINSSMenuItem1 = null;
	private JMenuItem cadastroTabelaFaixaIRPFMenuItem2 = null;
	private JMenuItem movimentacaoCalculoMensalMenuItem = null;
	private JMenuItem movimentacaoFolhaComplementarMenuItem = null;
	private JMenuItem movimentacaoFeriasMenuItem = null;
	private JMenuItem movimentacaoRecisaoMenuItem = null;
	private JMenuItem movimentacao13oSalarioMenuItem = null;
	private JMenuItem movimentacaoOcorrenciaMenuItem = null;
	private JMenuItem movimentacaoTransferenciaFuncionarioMenuItem = null;
	private JMenu cadastroFuncionarioMenu = null;
	private JMenuItem novoFuncionarioMenuItem = null;
	private JMenuItem pesquisarFuncionarioMenuItem = null;
	public Principal() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * This method initializes cadastroMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getCadastroMenu() {
		if (cadastroMenu == null) {
			cadastroMenu = new JMenu();
			cadastroMenu.setText("Cadastro");
			cadastroMenu.add(getCadastroEmpresaMenuItem());
			cadastroMenu.add(getCadastroTabelaMenu());
			cadastroMenu.add(getCadastroFolhasMenuItem());
			cadastroMenu.add(getCadastroFuncionarioMenu());
		}
		return cadastroMenu;
	}

	/**
	 * This method initializes movimentacaoMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMovimentacaoMenu() {
		if (movimentacaoMenu == null) {
			movimentacaoMenu = new JMenu();
			movimentacaoMenu.setText("Movimentação");
			movimentacaoMenu.add(getMovimentacaoCalculoMensalMenuItem());
			movimentacaoMenu.add(getMovimentacaoFolhaComplementarMenuItem());
			movimentacaoMenu.add(getMovimentacaoFeriasMenuItem());
			movimentacaoMenu.add(getMovimentacaoRecisaoMenuItem());
			movimentacaoMenu.add(getMovimentacao13oSalarioMenuItem());
			movimentacaoMenu.add(getMovimentacaoOcorrenciaMenuItem());
			movimentacaoMenu.add(getMovimentacaoTransferenciaFuncionarioMenuItem());
		}
		return movimentacaoMenu;
	}

	/**
	 * This method initializes relatorioMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getRelatorioMenu() {
		if (relatorioMenu == null) {
			relatorioMenu = new JMenu();
			relatorioMenu.setText("Relatório");
		}
		return relatorioMenu;
	}

	/**
	 * This method initializes utilitariosMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getUtilitariosMenu() {
		if (utilitariosMenu == null) {
			utilitariosMenu = new JMenu();
			utilitariosMenu.setText("Utilitátios");
		}
		return utilitariosMenu;
	}

	/**
	 * This method initializes cadastroEmpresaMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCadastroEmpresaMenuItem() {
		if (cadastroEmpresaMenuItem == null) {
			cadastroEmpresaMenuItem = new JMenuItem();
			cadastroEmpresaMenuItem.setText("Empresa");
			cadastroEmpresaMenuItem.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					FrmCadastroEmpresa frm = new FrmCadastroEmpresa();
					frm.setVisible(true);
				}
			});
		}
		return cadastroEmpresaMenuItem;
	}

	/**
	 * This method initializes cadastroFolhasMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCadastroFolhasMenuItem() {
		if (cadastroFolhasMenuItem == null) {
			cadastroFolhasMenuItem = new JMenuItem();
			cadastroFolhasMenuItem.setText("Folhas");
		}
		return cadastroFolhasMenuItem;
	}

	/**
	 * This method initializes cadastroTabelaMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getCadastroTabelaMenu() {
		if (cadastroTabelaMenu == null) {
			cadastroTabelaMenu = new JMenu();
			cadastroTabelaMenu.setText("Tabela");
			cadastroTabelaMenu.add(getCadastroTabelaFuncionarioMenu());
			cadastroTabelaMenu.add(getCadastroTabelaFaixaMenu());
		}
		return cadastroTabelaMenu;
	}

	/**
	 * This method initializes cadastroTabelaFuncionarioMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getCadastroTabelaFuncionarioMenu() {
		if (cadastroTabelaFuncionarioMenu == null) {
			cadastroTabelaFuncionarioMenu = new JMenu();
			cadastroTabelaFuncionarioMenu.setText("Funcionários");
			cadastroTabelaFuncionarioMenu.add(getCadastroTabelaFuncionarioCargoMenuItem());
			cadastroTabelaFuncionarioMenu.add(getCadastroTabelaFuncionarioCBOMenuItem());
		}
		return cadastroTabelaFuncionarioMenu;
	}

	/**
	 * This method initializes cadastroTabelaFaixaMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getCadastroTabelaFaixaMenu() {
		if (cadastroTabelaFaixaMenu == null) {
			cadastroTabelaFaixaMenu = new JMenu();
			cadastroTabelaFaixaMenu.setText("Faixas");
			cadastroTabelaFaixaMenu.add(getCadastroTabelaFaixaSalarioFamiliaMenuItem());
			cadastroTabelaFaixaMenu.add(getCadastroTabelaFaixaINSSMenuItem1());
			cadastroTabelaFaixaMenu.add(getCadastroTabelaFaixaIRPFMenuItem2());
		}
		return cadastroTabelaFaixaMenu;
	}

	/**
	 * This method initializes cadastroTabelaFuncionarioCargoMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCadastroTabelaFuncionarioCargoMenuItem() {
		if (cadastroTabelaFuncionarioCargoMenuItem == null) {
			cadastroTabelaFuncionarioCargoMenuItem = new JMenuItem();
			cadastroTabelaFuncionarioCargoMenuItem.setText("Cargos");
		}
		return cadastroTabelaFuncionarioCargoMenuItem;
	}

	/**
	 * This method initializes cadastroTabelaFuncionarioCBOMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCadastroTabelaFuncionarioCBOMenuItem() {
		if (cadastroTabelaFuncionarioCBOMenuItem == null) {
			cadastroTabelaFuncionarioCBOMenuItem = new JMenuItem();
			cadastroTabelaFuncionarioCBOMenuItem.setText("CBO");
		}
		return cadastroTabelaFuncionarioCBOMenuItem;
	}

	/**
	 * This method initializes cadastroTabelaFaixaSalarioFamiliaMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCadastroTabelaFaixaSalarioFamiliaMenuItem() {
		if (cadastroTabelaFaixaSalarioFamiliaMenuItem == null) {
			cadastroTabelaFaixaSalarioFamiliaMenuItem = new JMenuItem();
			cadastroTabelaFaixaSalarioFamiliaMenuItem.setText("Salário família");
		}
		return cadastroTabelaFaixaSalarioFamiliaMenuItem;
	}

	/**
	 * This method initializes cadastroTabelaFaixaINSSMenuItem1	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCadastroTabelaFaixaINSSMenuItem1() {
		if (cadastroTabelaFaixaINSSMenuItem1 == null) {
			cadastroTabelaFaixaINSSMenuItem1 = new JMenuItem();
			cadastroTabelaFaixaINSSMenuItem1.setText("INSS");
		}
		return cadastroTabelaFaixaINSSMenuItem1;
	}

	/**
	 * This method initializes cadastroTabelaFaixaIRPFMenuItem2	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCadastroTabelaFaixaIRPFMenuItem2() {
		if (cadastroTabelaFaixaIRPFMenuItem2 == null) {
			cadastroTabelaFaixaIRPFMenuItem2 = new JMenuItem();
			cadastroTabelaFaixaIRPFMenuItem2.setText("IRPF");
		}
		return cadastroTabelaFaixaIRPFMenuItem2;
	}

	/**
	 * This method initializes movimentacaoCalculoMensalMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMovimentacaoCalculoMensalMenuItem() {
		if (movimentacaoCalculoMensalMenuItem == null) {
			movimentacaoCalculoMensalMenuItem = new JMenuItem();
			movimentacaoCalculoMensalMenuItem.setText("Cálculo mensal");
		}
		return movimentacaoCalculoMensalMenuItem;
	}

	/**
	 * This method initializes movimentacaoFolhaComplementarMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMovimentacaoFolhaComplementarMenuItem() {
		if (movimentacaoFolhaComplementarMenuItem == null) {
			movimentacaoFolhaComplementarMenuItem = new JMenuItem();
			movimentacaoFolhaComplementarMenuItem.setText("Folha complementar");
		}
		return movimentacaoFolhaComplementarMenuItem;
	}

	/**
	 * This method initializes movimentacaoFeriasMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMovimentacaoFeriasMenuItem() {
		if (movimentacaoFeriasMenuItem == null) {
			movimentacaoFeriasMenuItem = new JMenuItem();
			movimentacaoFeriasMenuItem.setText("Férias");
		}
		return movimentacaoFeriasMenuItem;
	}

	/**
	 * This method initializes movimentacaoRecisaoMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMovimentacaoRecisaoMenuItem() {
		if (movimentacaoRecisaoMenuItem == null) {
			movimentacaoRecisaoMenuItem = new JMenuItem();
			movimentacaoRecisaoMenuItem.setText("Recisão");
		}
		return movimentacaoRecisaoMenuItem;
	}

	/**
	 * This method initializes movimentacao13oSalarioMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMovimentacao13oSalarioMenuItem() {
		if (movimentacao13oSalarioMenuItem == null) {
			movimentacao13oSalarioMenuItem = new JMenuItem();
			movimentacao13oSalarioMenuItem.setText("13o. Salário");
		}
		return movimentacao13oSalarioMenuItem;
	}

	/**
	 * This method initializes movimentacaoOcorrenciaMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMovimentacaoOcorrenciaMenuItem() {
		if (movimentacaoOcorrenciaMenuItem == null) {
			movimentacaoOcorrenciaMenuItem = new JMenuItem();
			movimentacaoOcorrenciaMenuItem.setText("Ocorrências");
		}
		return movimentacaoOcorrenciaMenuItem;
	}

	/**
	 * This method initializes movimentacaoTransferenciaFuncionarioMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMovimentacaoTransferenciaFuncionarioMenuItem() {
		if (movimentacaoTransferenciaFuncionarioMenuItem == null) {
			movimentacaoTransferenciaFuncionarioMenuItem = new JMenuItem();
			movimentacaoTransferenciaFuncionarioMenuItem.setText("Transferência de funcionário");
		}
		return movimentacaoTransferenciaFuncionarioMenuItem;
	}

	/**
	 * This method initializes cadastroFuncionarioMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getCadastroFuncionarioMenu() {
		if (cadastroFuncionarioMenu == null) {
			cadastroFuncionarioMenu = new JMenu();
			cadastroFuncionarioMenu.setText("Funcionário");
			cadastroFuncionarioMenu.add(getNovoFuncionarioMenuItem());
			cadastroFuncionarioMenu.add(getPesquisarFuncionarioMenuItem());
		}
		return cadastroFuncionarioMenu;
	}

	/**
	 * This method initializes novoFuncionarioMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getNovoFuncionarioMenuItem() {
		if (novoFuncionarioMenuItem == null) {
			novoFuncionarioMenuItem = new JMenuItem();
			novoFuncionarioMenuItem.setText("Novo Funcionário");
			novoFuncionarioMenuItem.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					FrmCadastroFuncionario frm = new FrmCadastroFuncionario();
					frm.setVisible(true);
				}
			});
		}
		return novoFuncionarioMenuItem;
	}

	/**
	 * This method initializes pesquisarFuncionarioMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getPesquisarFuncionarioMenuItem() {
		if (pesquisarFuncionarioMenuItem == null) {
			pesquisarFuncionarioMenuItem = new JMenuItem();
			pesquisarFuncionarioMenuItem.setText("Pesquisar Funcionário");
			pesquisarFuncionarioMenuItem
					.addActionListener(new java.awt.event.ActionListener() {
						public void actionPerformed(java.awt.event.ActionEvent e) {
							System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
							FrmPesquisaFuncionario frm = new FrmPesquisaFuncionario(null);
							frm.setVisible(true);
						}
					});
		}
		return pesquisarFuncionarioMenuItem;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				Principal application = new Principal();
				application.getJFrame().setVisible(true);
			}
		});
	}

	/**
	 * This method initializes jFrame
	 * 
	 * @return javax.swing.JFrame
	 */
	private JFrame getJFrame() {
		if (jFrame == null) {
			jFrame = new JFrame();
			jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			jFrame.setJMenuBar(getJJMenuBar());
			jFrame.setSize(570, 200);
			jFrame.setContentPane(getJContentPane());
			jFrame.setTitle("Folha de pagamento" +
					"");
		}
		return jFrame;
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
		}
		return jContentPane;
	}

	/**
	 * This method initializes jJMenuBar	
	 * 	
	 * @return javax.swing.JMenuBar	
	 */
	private JMenuBar getJJMenuBar() {
		if (jJMenuBar == null) {
			jJMenuBar = new JMenuBar();
			jJMenuBar.add(getFileMenu());
			jJMenuBar.add(getCadastroMenu());
			jJMenuBar.add(getMovimentacaoMenu());
			jJMenuBar.add(getRelatorioMenu());
			jJMenuBar.add(getUtilitariosMenu());
			jJMenuBar.add(getEditMenu());
			jJMenuBar.add(getHelpMenu());
		}
		return jJMenuBar;
	}

	/**
	 * This method initializes jMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getFileMenu() {
		if (fileMenu == null) {
			fileMenu = new JMenu();
			fileMenu.setText("Sistema");
			fileMenu.add(getSaveMenuItem());
			fileMenu.add(getExitMenuItem());
		}
		return fileMenu;
	}

	/**
	 * This method initializes jMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getEditMenu() {
		if (editMenu == null) {
			editMenu = new JMenu();
			editMenu.setText("Edit");
			editMenu.add(getCutMenuItem());
			editMenu.add(getCopyMenuItem());
			editMenu.add(getPasteMenuItem());
		}
		return editMenu;
	}

	/**
	 * This method initializes jMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getHelpMenu() {
		if (helpMenu == null) {
			helpMenu = new JMenu();
			helpMenu.setText("Help");
			helpMenu.add(getAboutMenuItem());
		}
		return helpMenu;
	}

	/**
	 * This method initializes jMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getExitMenuItem() {
		if (exitMenuItem == null) {
			exitMenuItem = new JMenuItem();
			exitMenuItem.setText("Exit");
			exitMenuItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					System.exit(0);
				}
			});
		}
		return exitMenuItem;
	}

	/**
	 * This method initializes jMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getAboutMenuItem() {
		if (aboutMenuItem == null) {
			aboutMenuItem = new JMenuItem();
			aboutMenuItem.setText("About");
			aboutMenuItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					JDialog aboutDialog = getAboutDialog();
					aboutDialog.pack();
					Point loc = getJFrame().getLocation();
					loc.translate(20, 20);
					aboutDialog.setLocation(loc);
					aboutDialog.setVisible(true);
				}
			});
		}
		return aboutMenuItem;
	}

	/**
	 * This method initializes aboutDialog	
	 * 	
	 * @return javax.swing.JDialog
	 */
	private JDialog getAboutDialog() {
		if (aboutDialog == null) {
			aboutDialog = new JDialog(getJFrame(), true);
			aboutDialog.setTitle("About");
			aboutDialog.setContentPane(getAboutContentPane());
		}
		return aboutDialog;
	}

	/**
	 * This method initializes aboutContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getAboutContentPane() {
		if (aboutContentPane == null) {
			aboutContentPane = new JPanel();
			aboutContentPane.setLayout(new BorderLayout());
			aboutContentPane.add(getAboutVersionLabel(), BorderLayout.CENTER);
		}
		return aboutContentPane;
	}

	/**
	 * This method initializes aboutVersionLabel	
	 * 	
	 * @return javax.swing.JLabel	
	 */
	private JLabel getAboutVersionLabel() {
		if (aboutVersionLabel == null) {
			aboutVersionLabel = new JLabel();
			aboutVersionLabel.setText("Version 1.0");
			aboutVersionLabel.setHorizontalAlignment(SwingConstants.CENTER);
		}
		return aboutVersionLabel;
	}

	/**
	 * This method initializes jMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCutMenuItem() {
		if (cutMenuItem == null) {
			cutMenuItem = new JMenuItem();
			cutMenuItem.setText("Cut");
			cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
					Event.CTRL_MASK, true));
		}
		return cutMenuItem;
	}

	/**
	 * This method initializes jMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getCopyMenuItem() {
		if (copyMenuItem == null) {
			copyMenuItem = new JMenuItem();
			copyMenuItem.setText("Copy");
			copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
					Event.CTRL_MASK, true));
		}
		return copyMenuItem;
	}

	/**
	 * This method initializes jMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getPasteMenuItem() {
		if (pasteMenuItem == null) {
			pasteMenuItem = new JMenuItem();
			pasteMenuItem.setText("Paste");
			pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
					Event.CTRL_MASK, true));
		}
		return pasteMenuItem;
	}

	/**
	 * This method initializes jMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getSaveMenuItem() {
		if (saveMenuItem == null) {
			saveMenuItem = new JMenuItem();
			saveMenuItem.setText("Save");
			saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
					Event.CTRL_MASK, true));
		}
		return saveMenuItem;
	}

}
